<template>
    <!--买房管家 === 搜素框和表格部分组件====ZxHousingManager-->
    <div>
        <!--搜素框部分-->
        <el-row>
            <el-col :span="24"><div class="grid-content bg-purple">
                <el-form :inline="true" v-model="seleceFrom" class="demo-form-inline">
                    <el-col :span="7">
                        <el-form-item label="会员注册手机">
                            <el-input v-model="seleceFrom.user_iphone" placeholder="请输入会员注册手机"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="7">
                        <el-form-item label="楼盘分析师">
                            <!--问题1：下拉列表里面是将获取的值:value="item.admin_account"
                            v-model="seleceFrom.admin_account"这里是将获取的值赋给给select
                            也就是这两处绑定的是不一样的-->
                            <el-select v-model="seleceFrom.admin_account" placeholder="请选择楼盘分析师">
                                <el-option v-for="item in formInline"
                                           :key="item.admin_account"
                                           :label="item.admin_name"
                                           :value="item.admin_account">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="7">
                        <el-form-item label="提交时间">
                            <el-date-picker type="date" placeholder="开始时间" v-model="formInline.user_reg_tiame" style="width: 100%;"></el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="3">
                        <el-form-item>
                            <el-button @click="onSubmit()" type="primary" plain>查询</el-button>
                        </el-form-item>
                    </el-col>
                </el-form>
            </div></el-col>
        </el-row>
        <template>
            <div>
                <el-table align="center" :data="tableData" border style="width: 100%">
                    <el-table-column align="center" type="selection" width="40" ></el-table-column>
                    <el-table-column align="center" prop="vipName" label="会员" min-width="80"></el-table-column>
                    <el-table-column align="center" prop="date" label="注册时间" min-width="100"></el-table-column>
                    <el-table-column align="center" prop="name" label="专属分析师" min-width="100"></el-table-column>
                    <el-table-column align="center" prop="name" label="找房委托" min-width="130"></el-table-column>
                    <el-table-column align="center" prop="name" label="楼盘测评" min-width="130"></el-table-column>
                    <el-table-column align="center" prop="name" label="看房直通车" min-width="120"></el-table-column>
                    <el-table-column align="center"prop="address" label="操作" min-width="240">
                        <el-button @click="addInformation()" type="text" size="mini" round>详情</el-button>
                        <el-button @click="addFind()" type="text" size="mini" round>委托</el-button>
                        <el-button @click="addText()" type="text" size="mini" round>测评</el-button>
                        <el-button @click="addLook()" type="text" size="mini" round>约车</el-button>
                    </el-table-column>
                </el-table>
                <el-pagination
                        :current-page="currentPage"
                        @current-change="elChangPage"
                        background layout="prev, pager, next"
                        :total="tableData.length">
                </el-pagination>
            </div>
        </template>
    </div>
</template>

<script>
    import * as api from "../utils/api";

    export default {
        name: "ZxHouseManagerTab",
        data(){
            return{
                input:'',
                checked: false,
                currentPage:1,
                options: [{
                    value: '选项1',
                    label: '张三'
                }, {
                    value: '选项2',
                    label: '李四'
                }],
                optionsTwo: [{
                    value: '选项1',
                    label: '安卓'
                }, {
                    value: '选项2',
                    label: 'iPhone'
                }],
                optionsDate: [{
                    value: '选项1',
                    label: '按照登录次数倒序'
                }, {
                    value: '选项2',
                    label: '按照最新登录时间排序'
                }],
                value: '',
                tableData: [
                    {
                        vipName:'',
                        date: '',
                        name: '',
                        address: ''
                    }],
                formInline: [
                    {
                        admin_account:'',
                        admin_name: '',
                        user_reg_tiame:'',
                    }
                ],
                seleceFrom:
                    {
                        user_iphone: '',
                        admin_account:'',
                        user_reg_tiame: '',
                    }
            }
        },
        created() {
            this.getFindAdmin()
        },
        methods: {
            /*点击页码*/
            elChangPage(){},
            /*点击 详情按钮 跳转详情界面*/
            addInformation(){
                this.$router.push({
                    name:'Information',
                    path:'/Home/ZxHousingManager/Information',
                    query: {
                    },
                })
            },
            /*点击 委托按钮 就添加一个选项卡  并跳转到===委托找房*/
            addFind(){
                this.$emit('show')
            },
            /*点击 楼盘测评 就添加一个选项卡  并跳转相应的====楼盘测评界面*/
            addText(){
                this.$emit('textHouse')
            },
            /*看房直通车 就添加一个选项卡  并跳转相应的====看房直通车*/
            addLook(){
                this.$emit('lookHouse')
            },
            /*点击查询之后===给页面重新赋值*/
            onSubmit() {
               /* console.log(this.seleceFrom);*/
                this.axios({
                    url:api.GET_FINDHOUSEMANGSEARCH,
                    method:'get',
                    params:{admin_account:this.seleceFrom.admin_account,
                        user_iphone:this.seleceFrom.user_iphone}
                }).then(data=>{
                    /*this.formInline=data.data.dataList*/
                    /*  console.log(data)*/
                }).catch(err=>{

                })
            },
            /*查询所有管理名称接口===已经分配委托===查询所有楼盘分析师*/
            getFindAdmin(){
                this.axios({
                    url:api.GET_FINDADMI,
                }).then(data=>{
                    this.formInline=data.data.data
                    /* console.log(data.data.data)*/
                }).catch(err=>{

                })
            }
        }
    }
</script>

<style scoped>

</style>